<template>
  <h1>EL组件-消息提示</h1>
  <el-button @click="f(1)" type="success">成功消息</el-button>
  <el-button @click="f(2)" type="warning">警告</el-button>
  <el-button @click="f(3)" type="error">出错了</el-button>
  <el-button @click="f(4)" type="info">提示</el-button>
  <el-button @click="f(5)" type="primary">可关闭消息</el-button>




</template>

<script setup>
import {ElMessage} from "element-plus";

const f = (type) => {
   switch (type) {
     case 1:ElMessage.success('成功了！');break;
     case 2:ElMessage.warning('警告！');break;
     case 3:ElMessage.error('出错了！');break;
     case 4:ElMessage.info('提示！');break;
     case 5:ElMessage.error({message:'可关闭消息',showClose:true})
   }
}
</script>

<style scoped>

</style>